package org.litu.app.service.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * 1. 代表当前类是一个配置类
 * 2.开启定时任务
 *
 * @author yueye
 */
@Configuration
@EnableScheduling
public class SampleSchedule {
    private final Logger logger = LoggerFactory.getLogger(SampleSchedule.class);

    /**
     * 每天凌晨执行的方法
     */
    @Scheduled(cron = "0 0 1 * * ?")
    private void agreementIsExpire() {
        logger.info("============== 开始 执行定时任务 =============");

        logger.info("定时执行内容");

        logger.info("============== 结束 执行定时任务 =============");
    }
}
